Skip to content

geotiff: read_geotiff_dask honours default max_pixels region cap (#1838)#1839

Merged
brendancol merged 1 commit into
mainfrom
issue-1838
May 14, 2026
Merged

geotiff: read_geotiff_dask honours default max_pixels region cap (#1838)#1839
brendancol merged 1 commit into
mainfrom
issue-1838

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Fixes #1838.

Summary

  • read_geotiff_dask documents that max_pixels=None uses the module default cap, but the up-front region guard at __init__.py:2462 gated on max_pixels is not None and silently skipped when None was passed.
  • Per-chunk reads already applied MAX_PIXELS_DEFAULT, and the VRT chunked path substituted the default before its up-front guard, so only the GeoTIFF dask path was inconsistent. Callers could construct a lazy graph far larger than the documented safety cap, with the oversize error deferred to compute time.
  • Substitute MAX_PIXELS_DEFAULT for None before the guard so eager, VRT, and dask paths share the same up-front safety semantics.

Test plan

  • New regression tests in test_dask_max_pixels_default_guard_1838.py cover the default-cap guard, the explicit-cap guard, and verify normal small reads are unaffected.
  • Related dask / max_pixels tests still pass (182 passed).

read_geotiff_dask documents that max_pixels=None uses the module
default cap, but the up-front region guard was gated on
max_pixels is not None and silently skipped when None was passed.
Per-chunk reads still applied MAX_PIXELS_DEFAULT, and the VRT chunked
path already substituted the default before its up-front guard, so
only the GeoTIFF dask path was inconsistent: callers could build a
lazy graph over a region far larger than the documented safety cap,
with the oversize error deferred to compute time.

Substitute MAX_PIXELS_DEFAULT for None before the guard so eager,
VRT, and dask paths share the same upfront safety semantics.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 14, 2026
@brendancol brendancol requested a review from Copilot May 14, 2026 15:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes read_geotiff_dask honor its documented default max_pixels cap during the up-front lazy-region guard, aligning GeoTIFF dask reads with eager and VRT chunked paths.

Changes:

  • Substitutes MAX_PIXELS_DEFAULT when max_pixels=None before checking the requested dask region size.
  • Adds regression tests for default cap enforcement, explicit cap enforcement, and normal small reads.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
xrspatial/geotiff/__init__.py Applies an effective max_pixels value before the dask region size guard.
xrspatial/geotiff/tests/test_dask_max_pixels_default_guard_1838.py Adds coverage for the corrected default-cap behavior in read_geotiff_dask.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@brendancol brendancol merged commit 81d5c26 into main May 14, 2026
16 checks passed
@brendancol brendancol deleted the issue-1838 branch May 15, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read_geotiff_dask skips default max_pixels region guard when max_pixels=None

2 participants